# 带有上下文，聊天历史

from llama_index.core.workflow import Context
import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
import config

# Create an agent workflow with our calculator tool
agent = FunctionAgent(
    llm=OpenAI(model="gpt-4o-mini"),
    system_prompt="You are a helpful assistant that can multiply two numbers.",
)
# create context
ctx = Context(agent)
async def main():
    # Run the agent
    # run agent with context
    response = await agent.run("My name is Logan", ctx=ctx)
    response = await agent.run("What is my name?", ctx=ctx)
    print(str(response))


# Run the agent
if __name__ == "__main__":
    asyncio.run(main())
